package cn.alm.springaihello.controller;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("function")
public class FunctionController {

    @Autowired
    private ChatClient chatClient;

    @GetMapping("test")
    public String test(@RequestParam String question) {
        String content = chatClient.prompt().user(question).call().content();
        return content;
    }

}
